<template>
  <div class="dashboard-container">
    <button @click="setData">存</button>
    <button @click="getData">取</button>
    <button @click="removeData">删</button>
    <button @click="clearData">清</button>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  data() {
    return {

    }
  },
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  methods: {
    setData() {
      sessionStorage.setItem('cccc', JSON.stringify({ name: '张三', age: 18 }))
    },
    getData() {
      console.log(JSON.parse(sessionStorage.getItem('cccc')))
    },
    removeData() {
      sessionStorage.removeItem('cccc')
    },
    clearData() {
      sessionStorage.clear()
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
